import store from '@/store'
import useUserStore from '@/store/user'

// 权限节点
export async function authority(e){
	let manager_id = useUserStore().name.manager_id
	let split_hash = (window.location.hash.split('#')[1]).split('?') // 截取当前路由
	let hash = split_hash[0] // 获取当前路由
	let nodes = store.state.node // 所有权限节点
	let current = [] // 当前路由所有权限
	let obj = {} // 应当赋予权限

	for(let item of nodes){
		if(item.url.includes(hash)){
			let arrurl = item.url.split('/')
			obj[arrurl[arrurl.length -1]] = true
		}
	}
	
	console.log('截取路由======',split_hash)
	console.log('当前路由======',hash)
	console.log('接口返回权限======',nodes)
	console.log('所有权限======',current)
	console.log('当前权限======',obj)
	// 回调信息使用方法，请参考 views/goods/info/index
	return obj
}

